function create_os()
{
	var jsonPost = '{"id":0,"vendor":"microsoft","product":"windows","version":"xp"}';
	
	// Using the core $.ajax() method
	$.ajax({
	    // the URL for the request
	    url: "http://localhost:8080/spruce/os/",
	 
	    // the data to send (will be converted to a query string)
	    data: jsonPost,
	    
	    // whether this is a POST or GET request
	    type: "POST",

		contentType: "application/json;charset=UTF-8",

	    // the type of data we expect back
	    dataType : "json",
	 
	    // code to run if the request succeeds;
	    // the response is passed to the function
	    success: function( json ) {
	        $( "<h1/>" ).text( json.title ).appendTo( "body" );
	        $( "<div class=\"content\"/>").html( json.html ).appendTo( "body" );
	    },
	 
	    // code to run if the request fails; the raw request and
	    // status codes are passed to the function
	    error: function( xhr, status, errorThrown ) {
	        alert( "Sorry, there was a problem!" );
	        console.log( "Error: " + errorThrown );
	        console.log( "Status: " + status );
	        console.dir( xhr );
	    },
	 
	    // code to run regardless of success or failure
	    complete: function( xhr, status ) {
	        alert( "The request is complete!" );
	    }
	});
}

function create_host()
{
	var jsonPost = '{"name":"localhost","ipAddress":"127.0.0.1","osID":1}';
	
	// Using the core $.ajax() method
	$.ajax({
	    // the URL for the request
	    url: "http://localhost:8080/spruce/host/",
	 
	    // the data to send (will be converted to a query string)
	    data: jsonPost,
	    
	    // whether this is a POST or GET request
	    type: "POST",

		contentType: "application/json;charset=UTF-8",

	    // the type of data we expect back
	    dataType : "json",
	 
	    // code to run if the request succeeds;
	    // the response is passed to the function
	    success: function( json ) {
	        $( "<h1/>" ).text( json.title ).appendTo( "body" );
	        $( "<div class=\"content\"/>").html( json.html ).appendTo( "body" );
	    },
	 
	    // code to run if the request fails; the raw request and
	    // status codes are passed to the function
	    error: function( xhr, status, errorThrown ) {
	        alert( "Sorry, there was a problem!" );
	        console.log( "Error: " + errorThrown );
	        console.log( "Status: " + status );
	        console.dir( xhr );
	    },
	 
	    // code to run regardless of success or failure
	    complete: function( xhr, status ) {
	        alert( "The request is complete!" );
	    }
	});
}

function create_service_group()
{
	var jsonPost = '{"id": 0, "name": "ServiceGroupTest"}';

	// Using the core $.ajax() method
	$.ajax({
	    // the URL for the request
	    url: "http://localhost:8080/spruce/servicegroup/",
	 
	    // the data to send (will be converted to a query string)
	    data: jsonPost,
	    
	    // whether this is a POST or GET request
	    type: "POST",

		contentType: "application/json;charset=UTF-8",

	    // the type of data we expect back
	    dataType : "json",
	 
	    // code to run if the request succeeds;
	    // the response is passed to the function
	    success: function( json ) {
	        $( "<h1/>" ).text( json.title ).appendTo( "body" );
	        $( "<div class=\"content\"/>").html( json.html ).appendTo( "body" );
	    },
	 
	    // code to run if the request fails; the raw request and
	    // status codes are passed to the function
	    error: function( xhr, status, errorThrown ) {
	        alert( "Sorry, there was a problem!" );
	        console.log( "Error: " + errorThrown );
	        console.log( "Status: " + status );
	        console.dir( xhr );
	    },
	 
	    // code to run regardless of success or failure
	    complete: function( xhr, status ) {
	        alert( "The request is complete!" );
	    }
	});
}

function create_service()
{
	var jsonPost = '{"id":0,"pluginName":"tcpTest","name":"tcpTest","serviceGroupID":1}';

	// Using the core $.ajax() method
	$.ajax({
	    // the URL for the request
	    url: "http://localhost:8080/spruce/service/",
	 
	    // the data to send (will be converted to a query string)
	    data: jsonPost,
	    
	    // whether this is a POST or GET request
	    type: "POST",

		contentType: "application/json;charset=UTF-8",

	    // the type of data we expect back
	    dataType : "json",
	 
	    // code to run if the request succeeds;
	    // the response is passed to the function
	    success: function( json ) {
	        $( "<h1/>" ).text( json.title ).appendTo( "body" );
	        $( "<div class=\"content\"/>").html( json.html ).appendTo( "body" );
	    },
	 
	    // code to run if the request fails; the raw request and
	    // status codes are passed to the function
	    error: function( xhr, status, errorThrown ) {
	        alert( "Sorry, there was a problem!" );
	        console.log( "Error: " + errorThrown );
	        console.log( "Status: " + status );
	        console.dir( xhr );
	    },
	 
	    // code to run regardless of success or failure
	    complete: function( xhr, status ) {
	        alert( "The request is complete!" );
	    }
	});
}

function create_service_schedule()
{
	var jsonPost = '{"cron": "0 0/1 * * * ?","hostID": 1,"serviceGroupID": 1}';

	// Using the core $.ajax() method
	$.ajax({
	    // the URL for the request
	    url: "http://localhost:8080/spruce/schedule/",
	 
	    // the data to send (will be converted to a query string)
	    data: jsonPost,
	    
	    // whether this is a POST or GET request
	    type: "POST",

		contentType: "application/json;charset=UTF-8",

	    // the type of data we expect back
	    dataType : "json",
	 
	    // code to run if the request succeeds;
	    // the response is passed to the function
	    success: function( json ) {
	        $( "<h1/>" ).text( json.title ).appendTo( "body" );
	        $( "<div class=\"content\"/>").html( json.html ).appendTo( "body" );
	    },
	 
	    // code to run if the request fails; the raw request and
	    // status codes are passed to the function
	    error: function( xhr, status, errorThrown ) {
	        alert( "Sorry, there was a problem!" );
	        console.log( "Error: " + errorThrown );
	        console.log( "Status: " + status );
	        console.dir( xhr );
	    },
	 
	    // code to run regardless of success or failure
	    complete: function( xhr, status ) {
	        alert( "The request is complete!" );
	    }
	});
}